Repository navigation
fix(fleet): restore-row-count-diff.sh missing option value is a usage error - #13040
Merged
Merged
Conversation
… error (#12788) Under set -u, '--manifest' with no value crashed with 'line 44: $2: unbound variable' (exit 1), and '--manifest --live /path' silently consumed --live as the manifest value. Parse strictly per the operator-script argument contract (#3352): a value option with no value, or a value that begins with '--', prints the usage message and exits 2. Adds scripts/tests/test_restore_row_count_diff.py (fails before, passes after), wired into scripts-test.yml and the test-suite registry following the provider-retirement-gate pattern.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12788
What was wrong
scripts/fleet/restore-row-count-diff.shruns underset -euo pipefailand consumed$2for--manifest/--live/--inventorywith no guard:bash scripts/fleet/restore-row-count-diff.sh --manifest→line 44: $2: unbound variable, exit 1 (a raw bash error, indistinguishable from a runtime failure).--manifest --live /pathsilently consumed--liveas the manifest value, then reportedunknown argument: /path.Fix
Strict parsing per the operator-script argument contract (#3352), in the script's existing style: a value option with no value, or a value that begins with
--, printsoption <name> requires a valueplus the usage message and exits 2 — the script's established usage exit code. The usage line now lives in oneusage()helper, also used by the existing missing-inputs check (same text, same exit).Evidence
Reproduced before the fix (unbound variable, exit 1; misparse of
--live). After the fix,--manifest,--live, and--inventorywith no value, and--manifest --live /path, all print usage and exit 2; a well-formed run still passes the gate.New regression test
scripts/tests/test_restore_row_count_diff.py(4 tests: missing value for each option, option-looking value, unknown argument, happy-path gate pass) — FAILED before the fix, PASSES after (python3 -m unittest discover -s scripts/tests -p 'test_restore_row_count_diff.py'→ OK). Wired intoscripts-test.ymland registered in.github/test-suite-registry.jsonfollowing the provider-retirement-gate pattern;check-suite-registry.shshows no new violations (the 3 it reports are the pre-existing #12230 gaps fixed by PR #12870).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.